//服务器的入口文件
// 1.创建KOA的实例对象
const Koa = require('koa')
const cors = require('koa2-cors')
const app = new Koa()
app.use(cors())
//2.绑定中间件
const duration = require('./middleware/koa_response_duration')
app.use(duration)

const headers = require('./middleware/koa_response_headers')
app.use(headers)

const data = require('./middleware/koa_response_data')
app.use(data)
//3.绑定端口号8888
app.listen(8888)

let webSocketService = require("./service/web_socket_service")
// 开启服务端的监听,监听客户端的连接
// 当某一个客户端连接成功后, 
webSocketService.listen()